package br.edu.unifei.mestrado.greedy;

import br.edu.unifei.mestrado.commons.graph.GraphWrapper;
import br.edu.unifei.mestrado.commons.partition.AbstractPartition;
import br.edu.unifei.mestrado.commons.partition.AbstractPartitionIndex;
import br.edu.unifei.mestrado.greedy.util.Partition;
import br.edu.unifei.mestrado.mem.graph.Graph;
import br.edu.unifei.mestrado.mem.graph.PartitionIndexMem;
import br.edu.unifei.mestrado.mn.GraphViewMem;

public class GreedyKWayMemory extends GreedyKWay {

	private GraphWrapper grafo = null;
	private GraphViewMem view = new GraphViewMem();

	public GreedyKWayMemory(String graphFileName) {
		grafo = new Graph(GraphWrapper.NO_LEVEL, graphFileName);
	}

	@Override
	protected GraphWrapper getGrafo() {
		return grafo;
	}
	
	@Override
	public AbstractPartitionIndex getPartitionIndex() {
		return new PartitionIndexMem(AbstractPartition.TWO_WAY);
	}

	@Override
	public void initView(GraphWrapper initialGraph) {
		view.initView(initialGraph);
	}

	@Override
	public void setShowView(boolean showView) {
		view.setShowView(showView);
	}

	@Override
	public void updateView(GraphWrapper grafo, String it, int cutWeight) {
		view.updateView(grafo, Partition.NO_LEVEL, it, cutWeight);
	}

	@Override
	public void repaint() {
		view.repaint();
	}
}
